package com.song.jinpu.controller;

import com.song.jinpu.bean.Goods;
import com.song.jinpu.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService ;

    @RequestMapping(value = "/test" , method = RequestMethod.GET)
    public String test(){
        return "测试结果";
    }

    /**
     *  查询所有商品
     * @return
     */
    @RequestMapping(value = "/query/all" , method = RequestMethod.GET)
    public List<Goods> queryAllGoods(){
        return goodsService.queryAllGoods();
    }

    @RequestMapping(value = "/query/{id}")
    public Goods queryOneGoods(@PathVariable("id") String id ){
        return goodsService.queryOneGoods(id);
    }

}
